import { reloadAuthorized } from './Authorized';

// use localStorage to store the authority info, which might be sent from server in actual project.
export function getAuthority(str?: string): any {
  const token = localStorage ? localStorage.getItem('token') : str;
  // authorityString could be admin, "admin", ["admin"]
  return token;
}

export function setAuthority(token: string): void {
  localStorage.setItem('token', token);
  // auto reload
  reloadAuthorized();
}
